/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 100;

void solve() {
  int n, d;
  cin >> n >> d;
  if (d > (n - 1) / 2) {
    cout << "No\n";
    return;
  }
  cout << "Yes\n";
  for (int j = 1; j <= d; ++j) {
    for (int i = 1; i <= n; ++i) {
      cout << i << ' ' << (i - 1 + j) % n + 1 << '\n';
    }
  }
}

int main() {
  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("C - Dyed by Majority (Odd Tree).in", "r", stdin);
  freopen("C - Dyed by Majority (Odd Tree).out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
